// 统一的API配置中心
export const API_CONFIG = {
  // 后端API配置
  BASE_URL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5152/api',
  SIGNALR_URL: import.meta.env.VITE_SIGNALR_URL || 'http://localhost:5152/gamehub',
  
  // API端点
  ENDPOINTS: {
    // 游戏相关
    CREATE_GAME: '/game/create',
    JOIN_GAME: '/game/join',
    LEAVE_GAME: '/game/leave',
    GET_GAME: (id) => `/game/${id}`,
    GET_GAME_BY_CODE: (code) => `/game/code/${code}`,
    PAINT_ACTION: '/game/paint',
    SET_READY: '/game/ready',
    GET_GAME_LIST: '/game/list',
    DELETE_GAME: (id) => `/game/${id}`,
    
    // SignalR事件
    SIGNALR: {
      JOIN_GAME: 'JoinGame',
      LEAVE_GAME: 'LeaveGame',
      PAINT_ACTION: 'PaintAction',
      START_GAME: 'StartGame',
      SEND_MESSAGE: 'SendMessage'
    },
    
    // SignalR接收事件
    SIGNALR_EVENTS: {
      PLAYER_JOINED: 'PlayerJoined',
      PLAYER_LEFT: 'PlayerLeft',
      GAME_JOINED: 'GameJoined',
      PAINT_ACTION_RECEIVED: 'PaintActionReceived',
      GAME_STARTED: 'GameStarted',
      ERROR: 'Error',
      MESSAGE_RECEIVED: 'MessageReceived'
    }
  },
  
  // 请求配置
  TIMEOUT: 10000,
  RETRY_ATTEMPTS: 3,
  RETRY_DELAY: 1000,
  
  // 游戏配置
  GAME: {
    MIN_PLAYERS: 2,
    MAX_PLAYERS: 6,
    DEFAULT_DURATION: 180, // 3分钟
    CANVAS_WIDTH: 800,
    CANVAS_HEIGHT: 600,
    BRUSH_SIZES: [5, 10, 15, 20, 25, 30],
    PLAYER_COLORS: [
      '#FF6B6B', // 红色
      '#4ECDC4', // 青色
      '#45B7D1', // 蓝色
      '#96CEB4', // 绿色
      '#FFEAA7', // 黄色
      '#DDA0DD'  // 紫色
    ]
  }
}

// 错误消息配置
export const ERROR_MESSAGES = {
  NETWORK_ERROR: '网络连接失败，请检查网络连接',
  SERVER_ERROR: '服务器错误，请稍后重试',
  GAME_NOT_FOUND: '游戏不存在或已结束',
  ROOM_FULL: '房间已满，无法加入',
  INVALID_ROOM_CODE: '房间码无效',
  PLAYER_NAME_TAKEN: '该昵称已被使用',
  GAME_ALREADY_STARTED: '游戏已开始，无法加入',
  GAME_CREATION_FAILED: '创建游戏失败',
  GAME_JOIN_FAILED: '加入游戏失败',
  DELETE_GAME_FAILED: '删除游戏失败',
  PAINT_ACTION_FAILED: '涂色动作失败',
  UNAUTHORIZED: '操作未授权',
  UNKNOWN_ERROR: '未知错误，请稍后重试'
}

// 成功消息配置
export const SUCCESS_MESSAGES = {
  GAME_CREATED: '房间创建成功',
  GAME_JOINED: '成功加入游戏',
  GAME_STARTED: '游戏开始',
  PAINT_ACTION_SENT: '涂色动作已发送',
  PLAYER_READY: '准备状态已更新',
  PLAYER_LEFT: '已离开房间'
}